<?php

namespace App\Models\Store\User;

class UserIdCardModel extends BaseUserModel
{
    protected $table = 'user_id_card';

    /**
     * 根据商户用户id查询数据
     * @param int $userId
     * @param array $fields
     * @return array
     */
    public function getItemByStoreUserId(int $userId, array $fields = self::QUERY_DEFAULT_FIELDS): array
    {
        $result = $this->select($fields)
                       ->where('store_user_id', $userId)
                       ->where('deleted', self::DELETED_NO)
                       ->first();
        return $result ? $result->toArray() : [];
    }
}
